<template>
  <div class="main">
    <div class="center">
      <div class="info">
        <div class="lf">
          <el-image lazy :src="movieDetailData.images" alt="" srcset="" />
        </div>
        <div class="rt">
          <div class="row">
            <div class="title">纪录片名</div>
            <div class="dian">：</div>
            <div class="text">{{ movieDetailData.name }}</div>
          </div>
          <div class="row">
            <div class="title">又名</div>
            <div class="dian">：</div>
            <div class="text">{{ movieDetailData.nickname }}</div>
          </div>
          <div class="row">
            <div class="title">评分</div>
            <div class="dian">：</div>
            <div class="text">{{ movieDetailData.score }}</div>
          </div>
          <div class="row">
            <div class="title">上映时间</div>
            <div class="dian">：</div>
            <div class="text">{{ movieDetailData.show_time }}</div>
          </div>
          <div class="row">
            <div class="title">类型</div>
            <div class="dian">：</div>
            <div class="text">{{ movieDetailData.attitude }}</div>
          </div>
          <div class="row">
            <div class="title">制片国家</div>
            <div class="dian">：</div>
            <div class="text">{{ movieDetailData.area }}</div>
          </div>
          <div class="row">
            <div class="title">语言</div>
            <div class="dian">：</div>
            <div class="text">{{ movieDetailData.language }}</div>
          </div>
          <div class="row">
            <div class="title">片长</div>
            <div class="dian">：</div>
            <div class="text">{{ movieDetailData.duration }}</div>
          </div>
          <div class="row">
            <div class="title">简介</div>
            <div class="dian">：</div>
            <div class="text" v-html="movieDetailData.detail"></div>
          </div>
        </div>
        <div class="play-btn">
          <a
            v-if="
              movieDetailData.url_1 != null &&
              movieDetailData.url_1 != '' &&
              movieDetailData.url_1 != 'None' &&
              movieDetailData.url_1 != undefined
            "
            :href="movieDetailData.url_1"
            target="_blank"
            rel="noopener noreferrer"
          >
            <el-image
              lazy
              :src="require('../assets/images/tx.png')"
              alt=""
              srcset=""
            />
          </a>
          <a
            v-if="
              movieDetailData.url_2 != null &&
              movieDetailData.url_2 != '' &&
              movieDetailData.url_2 != 'None' &&
              movieDetailData.url_2 != undefined
            "
            :href="movieDetailData.url_2"
            target="_blank"
            rel="noopener noreferrer"
          >
            <el-image
              lazy
              :src="require('../assets/images/iqiyi.png')"
              alt=""
              srcset=""
            />
          </a>
          <a
            v-if="
              movieDetailData.url_3 != null &&
              movieDetailData.url_3 != '' &&
              movieDetailData.url_3 != 'None' &&
              movieDetailData.url_3 != undefined
            "
            :href="movieDetailData.url_3"
            target="_blank"
            rel="noopener noreferrer"
          >
            <el-image
              lazy
              :src="require('../assets/images/youku.png')"
              alt=""
              srcset=""
            />
          </a>
        </div>
        <div class="qr-code">
          <el-image lazy :src="movieDetailData.code_url" alt="" srcset="" />
          <p>用手机观看</p>
        </div>
      </div>
      <!-- 演职人员 -->
      <div class="block-9" v-if="false">
        <div class="head">
          <div class="lf">演职人员</div>
          <!-- <router-link class="rt" to="">
            更多
            <el-image lazy src="../assets/images/jiantou-right.png" alt="" srcset="" />
          </router-link> -->
        </div>
        <div class="body">
          <swiper :options="swiperOptions" class="recommend">
            <swiper-slide v-for="(item, index) in 10" :key="index">
              <router-link to="">
                <el-image
                  lazy
                  src="http://placehold.it/150x180&text=150x180"
                  alt=""
                  srcset=""
                />
                <h1>尔冬升</h1>
                <p>导演</p>
              </router-link>
            </swiper-slide>
          </swiper>
        </div>
      </div>
      <!-- 相关图片 -->
      <template v-if="movieDetailData.images">
        <div class="block-5" v-if="movieDetailData.images.length > 0">
          <div class="head">
            <div class="lf">相关图片</div>
          </div>
          <div class="body">
            <router-link
              :to="{ name: 'relatedPicturesJlp', query: { id: item.id } }"
              v-for="(item, index) in movieDetailData.images"
              :key="index"
            >
              <div class="img h220">
                <el-image lazy :src="item" alt="" srcset="" />
              </div>
            </router-link>
          </div>
        </div>
      </template>
      <!-- 获奖情况 -->
      <!-- <div class="awards">
        <div class="title">获奖情况</div>
        <dl>
          <dt>第33届中国电影金鸡奖(2020)</dt>
          <dd>
            <p>最佳故事片(提名)</p>
            <p>最佳导演(提名)尔冬升/尔冬升/尔冬升/尔冬升/尔冬升/尔冬升</p>
          </dd>
        </dl>
        <dl>
          <dt>第33届中国电影金鸡奖(2020)</dt>
          <dd>
            <p>最佳故事片(提名)</p>
            <p>最佳导演(提名)尔冬升/尔冬升/尔冬升/尔冬升/尔冬升/尔冬升</p>
          </dd>
        </dl>
      </div> -->
    </div>
    <!-- 广告 -->
    <div class="ad">
      <a
        target="_blank"
        class="item"
        :href="item.url"
        v-for="(item, index) in adData.slice(0, 5)"
        :key="index"
      >
        <el-image lazy :src="item.image_mini" alt="" />
      </a>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      adData: [],
      movieDetailData: [], //电影详情
      // 演职人员
      swiperOptions: {
        slidesPerView: 9,
        spaceBetween: 20,
        freeMode: true,
      },
    };
  },
  created() {
    const id = this.$route.query.id;
    // 电影详情
    this.$http.getMovieDetail(id).then((res) => {
      if (res.data.code === 0) {
        this.movieDetailData = res.data.data;
      } else {
        this.$message.error("请求失败，请重试！");
      }
    });
    // 广告
    this.$http.getAd().then((res) => {
      if (res.data.code === 0) {
        this.adData = res.data.data;
      } else {
        this.$message.error("获取失败，请重试！");
      }
    });
  },
};
</script>

<style lang="scss" scoped>
.h220 {
  height: 220px;
}
.center {
  width: 1600px;
  margin: 0 auto;
  .info {
    display: flex;
    justify-content: space-between;
    margin: 76px 0;
    position: relative;
    .lf {
      width: 400px;
      height: 550px;
      box-shadow: 0px 6px 10px rgba(0, 0, 0, 0.5);
      .el-image {
        width: 100%;
        height: 100%;
      }
    }
    .rt {
      width: 1160px;
      .row {
        display: flex;
        font-size: 20px;
        font-family: PingFang SC;
        font-weight: 400;
        line-height: 28px;
        .title {
          width: 90px;
          text-align-last: justify;
          text-align: justify;
          text-justify: distribute-all-lines;
          color: #999999;
        }
        .dian {
          color: #999999;
        }
        .text {
          width: 935px;
          margin-left: 10px;
          color: #333333;
        }
      }
      .row:first-child {
        .text {
          font-weight: bold;
        }
      }
      .row:not(:first-child) {
        margin-top: 20px;
      }
      .row:not(:last-child) .text {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }
      .row:last-child .text {
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 6;
        overflow: hidden;
      }
    }
    .play-btn {
      position: absolute;
      top: 0;
      right: 280px;
      .el-image {
        width: 48px;
        height: 48px;
        cursor: pointer;
      }
      a:not(:first-child) {
        margin-left: 55px;
      }
    }
    .qr-code {
      position: absolute;
      top: 0;
      right: 120px;
      width: 120px;
      text-align: center;
      .el-image {
        width: 92px;
        height: 92px;
      }
      p {
        width: 120px;
        height: 28px;
        font-size: 20px;
        font-family: PingFang SC;
        font-weight: bold;
        line-height: 28px;
        color: #333333;
        text-align: center;
        margin-top: 8px;
      }
    }
  }
  .block-9 {
    margin-top: 20px;
    margin-bottom: 40px;
    .head {
      display: flex;
      justify-content: space-between;
      align-items: center;
      height: 45px;
      .lf {
        font-size: 20px;
        font-family: PingFang SC;
        font-weight: bold;
        color: #333333;
      }
      .rt {
        height: 45px;
        display: flex;
        align-items: center;
        font-size: 16px;
        font-family: PingFang SC;
        font-weight: 400;
        line-height: 40px;
        color: #666666;
        img {
          width: 14.85px;
          height: 25.46px;
          margin-left: 10px;
        }
      }
    }
    .body {
      margin-top: 20px;
      a {
        display: inline-block;
        width: 150px;
        text-align: center;
        img {
          width: 100%;
          height: 180px;
        }
        h1 {
          font-size: 20px;
          font-family: PingFang SC;
          font-weight: bold;
          line-height: 40px;
          color: #333333;
        }
        p {
          font-size: 16px;
          font-family: PingFang SC;
          font-weight: 400;
          line-height: 25px;
          color: #999999;
        }
      }
    }
  }
  .block-5 {
    margin-top: 20px;
    .head {
      display: flex;
      justify-content: space-between;
      align-items: center;
      height: 45px;
      .lf {
        font-size: 20px;
        font-family: PingFang SC;
        font-weight: bold;
        color: #333333;
      }
      .rt {
        height: 45px;
        display: flex;
        align-items: center;
        font-size: 16px;
        font-family: PingFang SC;
        font-weight: 400;
        line-height: 40px;
        color: #666666;
        .el-image {
          width: 14.85px;
          height: 25.46px;
          margin-left: 10px;
        }
      }
    }
    .body {
      display: flex;
      flex-wrap: wrap;
      justify-content: space-between;
      margin-top: 20px;
      a {
        display: inline-block;
        width: 300px;
        margin-bottom: 25px;
        .img {
          position: relative;
          .time-grade {
            width: 100%;
            position: absolute;
            left: 0;
            bottom: 15px;
            padding-left: 10px;
            padding-right: 30px;
            display: flex;
            justify-content: space-between;
            font-family: PingFang SC;
            font-weight: 400;
            .time {
              font-size: 20px;
              color: #f5f5f5;
            }
            .grade {
              font-size: 22px;
              color: #ff6f00;
            }
          }
          .el-image {
            width: 100%;
            height: 100%;
          }
        }
        h1 {
          font-size: 20px;
          font-family: PingFang SC;
          font-weight: 400;
          color: #333333;
          text-align: right;
          margin: 10px 0;
          overflow: hidden;
          text-overflow: ellipsis;
          white-space: nowrap;
        }
        p {
          font-size: 16px;
          font-family: PingFang SC;
          font-weight: 400;
          line-height: 22px;
          color: #999999;
          text-align: right;
          overflow: hidden;
          text-overflow: ellipsis;
          white-space: nowrap;
        }
      }
    }
  }
  .awards {
    margin-top: 20px;
    .title {
      font-size: 20px;
      font-family: PingFang SC;
      font-weight: bold;
      color: #333333;
    }
    dl {
      margin-bottom: 40px;
      dt {
        font-size: 20px;
        font-family: PingFang SC;
        font-weight: bold;
        line-height: 40px;
        color: #333333;
        padding: 20px 0;
      }
      dd {
        border-top: 1px solid #ccc;
        padding-top: 20px;
        p {
          font-size: 16px;
          font-family: PingFang SC;
          font-weight: 400;
          line-height: 33px;
          color: #666666;
        }
        p:first-child {
          margin-bottom: 10px;
        }
      }
    }
  }
}
.ad {
  position: fixed;
  top: 150px;
  right: 100px;
  z-index: 1000;
  .item {
    display: block;
    width: 150px;
    height: 150px;
    border-radius: 15px;
    overflow: hidden;
    .el-image {
      width: 100%;
      height: 100%;
    }
  }
  .item:not(:first-child) {
    margin-top: 30px;
  }
}
</style>